-
Notifications
You must be signed in to change notification settings - Fork 360
Blockbase: fixed alignments, take 999 #4448
Conversation
I fear there may be more wrong than just that bit... The editor and view are no longer matching in some situations. I think that we've made some incorrect assumptions about "How to identify containers that inherit layout" and how we should be applying that padding (the editor is applying the container- class to ALL containers regardless of if they inherit layout, define layout sizes or not) and this might need a deeper dive considering the "flex" layout in play. However the mismatch pictured above is wrong in /trunk, not caused by this change, so I believe it to be a separate-but-related issue. I'm keen to bring this change in now. I tried as many nested container situations as I could think of and (other than the problem in the editor noted above) this seems to be a step in the right direction. I'm definitely keen for others to look at this too though. |
I think the problem with this approach is that nested "inherit layout" containers don't collapse margins. Take this example markup:
So the child "inherit layout" block inherits additional unexpected padding... |
I fixed the nested containers with the extra padding. Still not happy with this alignments file... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just gave this another spin. Instead of adding padding to every block, I'm trying to add it to the container, then find the exceptions when we don't want that padding to be applied. I'm trying to think about what we are trying to achieve and what are all the possible cases: We want our blocks to have padding on mobile so that it's not touching the borders of the viewport, except for alignfull blocks. But when the alignfull block is a group and it contains text, this exception to the rule makes it look bad (like @jffng pointed out on the screenshot above). Should the exception be that only certain blocks that are alignfull should be going to the edges of the viewport then (cover, image, group with a background color...)? |
And in the case of the alignfull group blocks, if we want padding inside them, we can just add them to the block pattern/template, instead of having an overall css rule, we may not want to have it the same way in every case? |
Concepts merged with #4459 which has shipped. |
Changes proposed in this Pull Request:
I tried to understand why we were modifying margin+width for any nested containers but I couldn't see it clearly after reading the original PR that modifies it. I think I might be missing an edge case for this. I spent most of the time in this PR trying to find the ways this could break, I think having test content to cover most of the possible scenarios would help a lot.
This is the code that I used to test against, it is mostly based on the previous issues with have with alignments here and here:
Note that in the Before screenshot you can see a gap to the right of the site that was causing a horizontal scroll. That is also fixed with this PR
Related issue(s):
Closes #4426